<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Golem API documentation &mdash; Golem v1.0 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
          URL_ROOT:    '',
          VERSION:     '1.0',
          COLLAPSE_MODINDEX: false,
          FILE_SUFFIX: ''
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/interface.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="contents" title="Global table of contents" href="contents.html" />
    <link rel="index" title="Global index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="Golem v1.0 documentation" href="index.html" />
    <link rel="next" title="Colophon" href="colophon.html" />
    <link rel="prev" title="Golem examples" href="examples.html" />
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="colophon.html" title="Colophon"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="examples.html" title="Golem examples"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Golem v1.0 documentation</a> &raquo;</li>
      </ul>
    </div>
    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  
  <div class="section" id="golem-api-documentation">
<h1 id="golem-api-documentation">Golem API documentation<a class="headerlink" href="#golem-api-documentation" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-golem">
<h2 id="module-golem">golem<a class="headerlink" href="#module-golem" title="Permalink to this headline">¶</a></h2>
<p>The Golem ontology parsing library.</p>
<p>This module contains the main class which parses Golem/CML dictionaries, 
as defined by the CML and  Golem schemata, and allows you to use them to 
extract and convert information found in CML datafiles.</p>
<dl class="class">
<dt id="golem.Dictionary">
<!--[golem.Dictionary]-->class <tt class="descclassname">golem.</tt><tt class="descname">Dictionary</tt><big>(</big><em>filename=None</em>, <em>asModel=False</em><big>)</big><a class="headerlink" href="#golem.Dictionary" title="Permalink to this definition">¶</a></dt>
<dd><p>Main class for representing CML/Golem dictionaries.</p>
<p>Example of usage:</p>
<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">StringIO</span> <span class="kn">import</span> <span class="n">StringIO</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">dictionarystring</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;&lt;?xml version=&quot;1.0&quot;?&gt;</span>
<span class="gp">... </span><span class="s">&lt;dictionary </span>
<span class="gp">... </span><span class="s">  namespace=&quot;http://www.materialsgrid.org/castep/dictionary&quot;</span>
<span class="gp">... </span><span class="s">  dictionaryPrefix=&quot;castep&quot; </span>
<span class="gp">... </span><span class="s">  title=&quot;CASTEP Dictionary&quot;</span>
<span class="gp">... </span><span class="s">  xmlns=&quot;http://www.xml-cml.org/schema&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:h=&quot;http://www.w3.org/1999/xhtml/&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:cml=&quot;http://www.xml-cml.org/schema&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:golem=&quot;http://www.lexical.org.uk/golem&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;</span>
<span class="gp">... </span><span class="s">  &lt;entry id=&quot;xcFunctional&quot; term=&quot;Exchange-Correlation Functional&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;annotation /&gt;</span>
<span class="gp">... </span><span class="s">    &lt;definition&gt;</span>
<span class="gp">... </span><span class="s">      The exchange-correlation functional used.</span>
<span class="gp">... </span><span class="s">    &lt;/definition&gt;</span>
<span class="gp">... </span><span class="s">    &lt;description&gt;</span>
<span class="gp">... </span><span class="s">     &lt;h:div class=&quot;dictDescription&quot;&gt;</span>
<span class="gp">... </span><span class="s">        Available values for this are:</span>
<span class="gp">... </span><span class="s">        &lt;h:ul&gt;</span>
<span class="gp">... </span><span class="s">          &lt;h:li&gt;</span>
<span class="gp">... </span><span class="s">            &lt;h:strong&gt;LDA&lt;/h:strong&gt;</span>
<span class="gp">... </span><span class="s">            , the Local Density Approximation</span>
<span class="gp">... </span><span class="s">          &lt;/h:li&gt;</span>
<span class="gp">... </span><span class="s">          &lt;h:li&gt;</span>
<span class="gp">... </span><span class="s">            &lt;h:strong&gt;PW91&lt;/h:strong&gt;</span>
<span class="gp">... </span><span class="s">            , Perdew and Wang&#39;s 1991 formulation</span>
<span class="gp">... </span><span class="s">          &lt;/h:li&gt;</span>
<span class="gp">... </span><span class="s">          &lt;h:li&gt;</span>
<span class="gp">... </span><span class="s">            &lt;h:strong&gt;PBE&lt;/h:strong&gt;</span>
<span class="gp">... </span><span class="s">            Perdew, Burke and Enzerhof&#39;s original GGA</span>
<span class="gp">... </span><span class="s">            functional</span>
<span class="gp">... </span><span class="s">          &lt;/h:li&gt;</span>
<span class="gp">... </span><span class="s">          &lt;h:li&gt;</span>
<span class="gp">... </span><span class="s">            &lt;h:strong&gt;RPBE&lt;/h:strong&gt;</span>
<span class="gp">... </span><span class="s">            , Hammer et al&#39;s revised PBE functional</span>
<span class="gp">... </span><span class="s">          &lt;/h:li&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/h:ul&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/h:div&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/description&gt;</span>
<span class="gp">... </span><span class="s">    </span>
<span class="gp">... </span><span class="s">    &lt;metadataList&gt;</span>
<span class="gp">... </span><span class="s">      &lt;metadata name=&quot;dc:author&quot; content=&quot;golem-kiln&quot; /&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/metadataList&gt;</span>
<span class="gp">... </span><span class="s">    &lt;golem:xpath&gt;/cml:cml/cml:parameterList[@dictRef=&quot;input&quot;]/cml:parameter[@dictRef=&quot;castep:xcFunctional&quot;]&lt;/golem:xpath&gt;</span>
<span class="gp">... </span><span class="s">    &lt;golem:template call=&quot;scalar&quot; role=&quot;getvalue&quot; binding=&quot;pygolem_serialization&quot; /&gt;</span>
<span class="gp">... </span><span class="s">    &lt;golem:template role=&quot;arb_to_input&quot; binding=&quot;input&quot; input=&quot;external&quot;&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:stylesheet version=&#39;1.0&#39; </span>
<span class="gp">... </span><span class="s">                      xmlns:xsl=&#39;http://www.w3.org/1999/XSL/Transform&#39;</span>
<span class="gp">... </span><span class="s">                      xmlns:cml=&#39;http://www.xml-cml.org/schema&#39;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:strip-space elements=&quot;*&quot; /&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:output method=&quot;text&quot; /&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:param name=&quot;p1&quot; /&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:template match=&quot;/&quot;&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:text&gt;XC_FUNCTIONAL &lt;/xsl:text&gt;&lt;xsl:value-of select=&quot;$p1&quot; /&gt;      </span>
<span class="gp">... </span><span class="s">  &lt;/xsl:template&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:stylesheet&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/golem:template&gt;</span>
<span class="gp">... </span><span class="s">    &lt;golem:implements&gt;convertibleToInput&lt;/golem:implements&gt;</span>
<span class="gp">... </span><span class="s">    &lt;golem:implements&gt;value&lt;/golem:implements&gt;</span>
<span class="gp">... </span><span class="s">    &lt;golem:implements&gt;absolute&lt;/golem:implements&gt;</span>
<span class="gp">... </span><span class="s">    &lt;golem:childOf&gt;input&lt;/golem:childOf&gt;</span>
<span class="gp">... </span><span class="s"></span>
<span class="gp">... </span><span class="s">    &lt;golem:possibleValues type=&quot;string&quot;&gt;</span>
<span class="gp">... </span><span class="s">      &lt;golem:enumeration&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;LDA&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;PW91&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;PBE&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;RPBE&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;HF&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;SHF&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;EXX&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;SX&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;ZERO&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;HF-LDA&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;SHF-LDA&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;EXX-LDA&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">        &lt;golem:value&gt;SX-LDA&lt;/golem:value&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/golem:enumeration&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/golem:possibleValues&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/entry&gt;</span>
<span class="gp">... </span><span class="s"></span>
<span class="gp">... </span><span class="s">&lt;entry id=&quot;scalar&quot; term=&quot;Scalar default call&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;annotation /&gt;</span>
<span class="gp">... </span><span class="s">    &lt;definition /&gt;</span>
<span class="gp">... </span><span class="s">    &lt;description /&gt;</span>
<span class="gp">... </span><span class="s">    &lt;metadataList /&gt;</span>
<span class="gp">... </span><span class="s">    &lt;golem:template role=&quot;getvalue&quot; binding=&quot;pygolem_serialization&quot;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:stylesheet version=&#39;1.0&#39; </span>
<span class="gp">... </span><span class="s">                xmlns:xsl=&#39;http://www.w3.org/1999/XSL/Transform&#39;</span>
<span class="gp">... </span><span class="s">                xmlns:cml=&#39;http://www.xml-cml.org/schema&#39;</span>
<span class="gp">... </span><span class="s">                xmlns:str=&quot;http://exslt.org/strings&quot;</span>
<span class="gp">... </span><span class="s">                xmlns:func=&quot;http://exslt.org/functions&quot;</span>
<span class="gp">... </span><span class="s">                xmlns:exsl=&quot;http://exslt.org/common&quot;</span>
<span class="gp">... </span><span class="s">                xmlns:tohw=&quot;http://www.uszla.me.uk/xsl/1.0/functions&quot;</span>
<span class="gp">... </span><span class="s">                extension-element-prefixes=&quot;func exsl tohw str&quot;</span>
<span class="gp">... </span><span class="s">                exclude-result-prefixes=&quot;exsl func tohw xsl str&quot;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:output method=&quot;text&quot; /&gt;</span>
<span class="gp">... </span><span class="s">  </span>
<span class="gp">... </span><span class="s">  </span>
<span class="gp">... </span><span class="s">  &lt;func:function name=&quot;tohw:isAListOfDigits&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;!-- look only for [0-9]+ --&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:param name=&quot;x_&quot;/&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:variable name=&quot;x&quot; select=&quot;normalize-space($x_)&quot;/&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:when test=&quot;string-length($x)=0&quot;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;func:result select=&quot;false()&quot;/&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:when test=&quot;substring($x, 1, 1)=&#39;0&#39; or</span>
<span class="gp">... </span><span class="s">                      substring($x, 1, 1)=&#39;1&#39; or</span>
<span class="gp">... </span><span class="s">                      substring($x, 1, 1)=&#39;2&#39; or</span>
<span class="gp">... </span><span class="s">                      substring($x, 1, 1)=&#39;3&#39; or</span>
<span class="gp">... </span><span class="s">                      substring($x, 1, 1)=&#39;4&#39; or</span>
<span class="gp">... </span><span class="s">                      substring($x, 1, 1)=&#39;5&#39; or</span>
<span class="gp">... </span><span class="s">                      substring($x, 1, 1)=&#39;6&#39; or</span>
<span class="gp">... </span><span class="s">                      substring($x, 1, 1)=&#39;7&#39; or</span>
<span class="gp">... </span><span class="s">                      substring($x, 1, 1)=&#39;8&#39; or</span>
<span class="gp">... </span><span class="s">                      substring($x, 1, 1)=&#39;9&#39;&quot;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:when test=&quot;string-length($x)=1&quot;&gt;</span>
<span class="gp">... </span><span class="s">            &lt;func:result select=&quot;true()&quot;/&gt;</span>
<span class="gp">... </span><span class="s">          &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">            &lt;func:result select=&quot;tohw:isAListOfDigits(substring($x, 2))&quot;/&gt;</span>
<span class="gp">... </span><span class="s">          &lt;/xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">        &lt;func:result select=&quot;false()&quot;/&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/func:function&gt;</span>
<span class="gp">... </span><span class="s"></span>
<span class="gp">... </span><span class="s">  &lt;func:function name=&quot;tohw:isAnInteger&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;!-- numbers fitting [\+-][0-9]+ --&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:param name=&quot;x_&quot;/&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:variable name=&quot;x&quot; select=&quot;normalize-space($x_)&quot;/&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:variable name=&quot;try&quot;&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:when test=&quot;starts-with($x, &#39;+&#39;)&quot;&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:value-of select=&quot;substring($x,2)&quot;/&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:when test=&quot;starts-with($x, &#39;-&#39;)&quot;&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:value-of select=&quot;substring($x,2)&quot;/&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:value-of select=&quot;$x&quot;/&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/xsl:variable&gt;</span>
<span class="gp">... </span><span class="s">    &lt;func:result select=&quot;tohw:isAListOfDigits($try)&quot;/&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/func:function&gt;</span>
<span class="gp">... </span><span class="s"></span>
<span class="gp">... </span><span class="s">  &lt;func:function name=&quot;tohw:isANumberWithoutExponent&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;!-- numbers fitting [\+-][0-9]+(\.[0-9]*) --&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:param name=&quot;x&quot;/&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:when test=&quot;contains($x, &#39;.&#39;)&quot;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;func:result select=&quot;tohw:isAnInteger(substring-before($x, &#39;.&#39;)) and</span>
<span class="gp">... </span><span class="s">                             tohw:isAListOfDigits(substring-after($x, &#39;.&#39;))&quot;/&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">        &lt;func:result select=&quot;tohw:isAnInteger($x)&quot;/&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/func:function&gt;</span>
<span class="gp">... </span><span class="s"></span>
<span class="gp">... </span><span class="s">  &lt;func:function name=&quot;tohw:isAnFPNumber&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;!-- Try and interpret a string as an exponential number --&gt;</span>
<span class="gp">... </span><span class="s">    &lt;!-- should only recognise strings of the form: [\+-][0-9]*\.[0-9]*([DdEe][+-][0-9]+)? --&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:param name=&quot;x&quot;/&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:when test=&quot;contains($x, &#39;d&#39;)&quot;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;func:result select=&quot;tohw:isANumberWithoutExponent(substring-before($x, &#39;d&#39;)) and</span>
<span class="gp">... </span><span class="s">                             tohw:isAnInteger(substring-after($x, &#39;d&#39;))&quot;/&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:when test=&quot;contains($x, &#39;D&#39;)&quot;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;func:result select=&quot;tohw:isANumberWithoutExponent(substring-before($x, &#39;D&#39;)) and</span>
<span class="gp">... </span><span class="s">                             tohw:isAnInteger(substring-after($x, &#39;D&#39;))&quot;/&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:when test=&quot;contains($x, &#39;e&#39;)&quot;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;func:result select=&quot;tohw:isANumberWithoutExponent(substring-before($x, &#39;e&#39;)) and</span>
<span class="gp">... </span><span class="s">                             tohw:isAnInteger(substring-after($x, &#39;e&#39;))&quot;/&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:when test=&quot;contains($x, &#39;E&#39;)&quot;&gt;</span>
<span class="gp">... </span><span class="s">        &lt;func:result select=&quot;tohw:isANumberWithoutExponent(substring-before($x, &#39;E&#39;)) and</span>
<span class="gp">... </span><span class="s">                             tohw:isAnInteger(substring-after($x, &#39;E&#39;))&quot;/&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">         &lt;func:result select=&quot;tohw:isANumberWithoutExponent($x)&quot;/&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/func:function&gt;</span>
<span class="gp">... </span><span class="s">        </span>
<span class="gp">... </span><span class="s">  &lt;xsl:template match=&quot;/&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:apply-templates /&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/xsl:template&gt;</span>
<span class="gp">... </span><span class="s">    </span>
<span class="gp">... </span><span class="s">  &lt;xsl:template match=&quot;cml:scalar&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:variable name=&quot;value&quot;&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:when test=&quot;tohw:isAnFPNumber(.)&quot;&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:value-of select=&quot;.&quot; /&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:text&gt;&quot;&lt;/xsl:text&gt;&lt;xsl:value-of select=&quot;.&quot; /&gt;&lt;xsl:text&gt;&quot;&lt;/xsl:text&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/xsl:variable&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:variable name=&quot;units&quot;&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:when test=&quot;@units&quot;&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:text&gt;&quot;&lt;/xsl:text&gt;&lt;xsl:value-of select=&quot;@units&quot; /&gt;&lt;xsl:text&gt;&quot;&lt;/xsl:text&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/xsl:when&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:text&gt;&quot;&quot;&lt;/xsl:text&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/xsl:otherwise&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:choose&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/xsl:variable&gt;</span>
<span class="gp">... </span><span class="s">    &lt;xsl:text&gt;[&lt;/xsl:text&gt;&lt;xsl:value-of select=&quot;$value&quot;/&gt;&lt;xsl:text&gt;,&lt;/xsl:text&gt;&lt;xsl:value-of select=&quot;$units&quot; /&gt;&lt;xsl:text&gt;]&lt;/xsl:text&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/xsl:template&gt;</span>
<span class="gp">... </span><span class="s">&lt;/xsl:stylesheet&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/golem:template&gt;</span>
<span class="gp">... </span><span class="s"></span>
<span class="gp">... </span><span class="s">    &lt;golem:template role=&quot;defaultoutput&quot;&gt;</span>
<span class="gp">... </span><span class="s">      &lt;xsl:stylesheet version=&#39;1.0&#39; </span>
<span class="gp">... </span><span class="s">                      xmlns:xsl=&#39;http://www.w3.org/1999/XSL/Transform&#39;</span>
<span class="gp">... </span><span class="s">                      xmlns:cml=&#39;http://www.xml-cml.org/schema&#39;</span>
<span class="gp">... </span><span class="s">                      xmlns:str=&quot;http://exslt.org/strings&quot;</span>
<span class="gp">... </span><span class="s">                      extension-element-prefixes=&quot;str&quot;</span>
<span class="gp">... </span><span class="s">                      &gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:output method=&quot;text&quot; /&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:param name=&quot;name&quot; /&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:param name=&quot;value&quot; /&gt;</span>
<span class="gp">... </span><span class="s">        &lt;xsl:template match=&quot;/&quot;&gt;</span>
<span class="gp">... </span><span class="s">          &lt;xsl:value-of select=&#39;$name&#39; /&gt;&lt;xsl:value-of select=&#39;$value&#39; /&gt;</span>
<span class="gp">... </span><span class="s">        &lt;/xsl:template&gt;</span>
<span class="gp">... </span><span class="s">      &lt;/xsl:stylesheet&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/golem:template&gt;</span>
<span class="gp">... </span><span class="s">    &lt;golem:seealso&gt;gwtsystem&lt;/golem:seealso&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/entry&gt;</span>
<span class="gp">... </span><span class="s">&lt;/dictionary&gt;</span>
<span class="gp">... </span><span class="s">&quot;&quot;&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">Dictionary</span><span class="p">(</span><span class="n">StringIO</span><span class="p">(</span><span class="n">dictionarystring</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">xcf</span> <span class="o">=</span> <span class="n">d</span><span class="p">[</span><span class="s">&quot;{http://www.materialsgrid.org/castep/dictionary}xcFunctional&quot;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">cmlstr</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span class="gp">... </span><span class="s">&lt;?xml-stylesheet href=&quot;display.xsl&quot; type=&quot;text/xsl&quot;?&gt;</span>
<span class="gp">... </span><span class="s">&lt;cml convention=&quot;FoX_wcml-2.0&quot; fileId=&quot;NaCl_00GPa.xml&quot; version=&quot;2.4&quot;</span>
<span class="gp">... </span><span class="s">  xmlns=&quot;http://www.xml-cml.org/schema&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:castep=&quot;http://www.materialsgrid.org/castep/dictionary&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:castepunits=&quot;http://www.materialsgrid.org/castep/units&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:cml=&quot;http://www.xml-cml.org/dict/cmlDict&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:dc=&quot;http://purl.org/dc/elements/1.1/title&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:units=&quot;http://www.uszla.me.uk/FoX/units&quot;</span>
<span class="gp">... </span><span class="s">  xmlns:atomicUnits=&quot;http://www.xml-cml.org/units/atomic&quot;&gt;</span>
<span class="gp">... </span><span class="s">  &lt;metadataList title=&quot;Autocaptured metadata&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;metadata name=&quot;dc:date&quot; content=&quot;2007-02-09&quot;/&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/metadataList&gt;</span>
<span class="gp">... </span><span class="s">  &lt;parameterList dictRef=&quot;input&quot; convention=&quot;Input Parameters&quot;&gt;</span>
<span class="gp">... </span><span class="s">    &lt;parameter dictRef=&quot;castep:xcFunctional&quot;</span>
<span class="gp">... </span><span class="s">      name=&quot;Exchange-Correlation Functional&quot;&gt;</span>
<span class="gp">... </span><span class="s">      &lt;scalar dataType=&quot;xsd:string&quot;&gt;PBE&lt;/scalar&gt;</span>
<span class="gp">... </span><span class="s">    &lt;/parameter&gt;</span>
<span class="gp">... </span><span class="s">  &lt;/parameterList&gt;</span>
<span class="gp">... </span><span class="s">&lt;/cml&gt;</span>
<span class="gp">... </span><span class="s">&quot;&quot;&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">tree</span> <span class="o">=</span> <span class="n">etree</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">StringIO</span><span class="p">(</span><span class="n">cmlstr</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">xcfd</span> <span class="o">=</span> <span class="n">xcf</span><span class="o">.</span><span class="n">findin</span><span class="p">(</span><span class="n">tree</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="nb">len</span><span class="p">(</span><span class="n">xcfd</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">xcval</span> <span class="o">=</span> <span class="n">xcf</span><span class="o">.</span><span class="n">getvalue</span><span class="p">(</span><span class="n">xcfd</span><span class="p">[</span><span class="mf">0</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">xcf</span><span class="o">.</span><span class="n">getvalue</span><span class="p">(</span><span class="n">xcfd</span><span class="p">[</span><span class="mf">0</span><span class="p">])</span>
<span class="go">PBE</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># units are not defined on XCFunctional, so:</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">xcval</span><span class="o">.</span><span class="n">unit</span>
<span class="go">golem:undefined</span>
<span class="gp">&gt;&gt;&gt; </span><span class="c"># by convention</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">xcval</span><span class="o">.</span><span class="n">entry</span><span class="o">.</span><span class="n">definition</span>
<span class="go">&lt;BLANKLINE&gt;</span>
<span class="go">      The exchange-correlation functional used.</span>
<span class="go">&lt;BLANKLINE&gt;</span>
</pre></div>
<dl class="method">
<dt id="golem.Dictionary.parsexml">
<!--[golem.Dictionary.parsexml]--><tt class="descname">parsexml</tt><big>(</big><em>filename</em>, <em>asModel=False</em><big>)</big><a class="headerlink" href="#golem.Dictionary.parsexml" title="Permalink to this definition">¶</a></dt>
<dd>Load and parse a CML dictionary.</dd></dl>

<dl class="method">
<dt id="golem.Dictionary.serialize">
<!--[golem.Dictionary.serialize]--><tt class="descname">serialize</tt><big>(</big><em>ordering=None</em><big>)</big><a class="headerlink" href="#golem.Dictionary.serialize" title="Permalink to this definition">¶</a></dt>
<dd>Serialize a dictionary back to XML.</dd></dl>

</dd></dl>

<dl class="class">
<dt id="golem.Entry">
<!--[golem.Entry]-->class <tt class="descclassname">golem.</tt><tt class="descname">Entry</tt><big>(</big><em>d</em>, <em>ns</em>, <em>xml=None</em>, <em>asModel=False</em><big>)</big><a class="headerlink" href="#golem.Entry" title="Permalink to this definition">¶</a></dt>
<dd><p>The Entry class represents an entry in a Golem/CML dictionary.</p>
<p>Entries have the following structure:</p>
<pre>&lt;entry id="template" term="Template entry"&gt;
  &lt;annotation&gt;
    &lt;appinfo&gt;&lt;!-- CML-specific machine-processable information --&gt;&lt;/appinfo&gt;
  &lt;/annotation&gt;
  &lt;definition&gt;Human-readable one-liner definition&lt;/definition&gt;
  &lt;description&gt;Substantial human-readable documentation&lt;/description&gt;
  &lt;metadataList&gt;&lt;!-- Dublin Core semantics --&gt;
    &lt;metadata name="dc:creator" content="Test Author" /&gt;
  &lt;/metadataList&gt;
  &lt;golem:xpath&gt;&lt;/golem:xpath&gt;
  &lt;golem:template role="role" binding="binding"&gt; &lt;!-- and optionally "@input" --&gt;
  &lt;/golem:template&gt;
  &lt;golem:possibleValues type="DATATYPE"&gt;
    &lt;golem:range&gt;
      &lt;golem:minimum&gt;1&lt;/golem:minimum&gt;
      &lt;golem:maximum&gt;100&lt;/golem:maximum&gt;
    &lt;/golem:range&gt;
    &lt;!-- or --&gt;
    &lt;golem:enumeration&gt;
      &lt;golem:value&gt;1&lt;/golem:value&gt;
      &lt;golem:value&gt;2&lt;/golem:value&gt;
      &lt;golem:value&gt;3&lt;/golem:value&gt;
    &lt;/golem:enumeration&gt;
  &lt;/golem:possibleValues&gt; &lt;!-- or matrix ... --&gt;
  &lt;golem:implements&gt;otherEntry&lt;/golem:implements&gt; &lt;!-- times n --&gt;
  &lt;golem:synonym&gt;synonymousEntry&lt;/golem:synonym&gt; &lt;!-- times n --&gt;
  &lt;golem:seealso&gt;similarEntry&lt;/golem:seealso&gt; &lt;!-- times n --&gt;
  &lt;golem:childOf&gt;parentEntry&lt;/golem:childOf&gt; &lt;!-- times n --&gt;
&lt;/entry&gt;</pre>
<dl class="method">
<dt id="golem.Entry.boundscheck">
<!--[golem.Entry.boundscheck]--><tt class="descname">boundscheck</tt><big>(</big><em>arb</em>, <em>ctype=''</em><big>)</big><a class="headerlink" href="#golem.Entry.boundscheck" title="Permalink to this definition">¶</a></dt>
<dd>Check that a given piece of data is of the type, and lies within the bounds,
defined in this dictionary entry.</dd></dl>

<dl class="method">
<dt id="golem.Entry.dcall">
<!--[golem.Entry.dcall]--><tt class="descname">dcall</tt><big>(</big><em>template</em>, <em>arb</em><big>)</big><a class="headerlink" href="#golem.Entry.dcall" title="Permalink to this definition">¶</a></dt>
<dd><p>Internal method (you&#8217;ll never call this directly); bounds-check a piece
of data and template it into an associated &lt;golem:template&gt; defined in
the dictionary. These are mapped onto Python methods named after the
name of the &lt;golem:template&gt;.</p>
<p>In other words, this is where entry.to_value calls come from.</p>
</dd></dl>

<dl class="method">
<dt id="golem.Entry.findin">
<!--[golem.Entry.findin]--><tt class="descname">findin</tt><big>(</big><em>*trees</em><big>)</big><a class="headerlink" href="#golem.Entry.findin" title="Permalink to this definition">¶</a></dt>
<dd>Find instances of this dictionary entry in a given ElementTree
or set of ElementTrees. This version supplies <em>new</em>, rerooted
ElementTrees, not just the old ElementTrees with a pointer to 
the right context - use findin_context for that.</dd></dl>

<dl class="method">
<dt id="golem.Entry.findin_context">
<!--[golem.Entry.findin_context]--><tt class="descname">findin_context</tt><big>(</big><em>*trees</em><big>)</big><a class="headerlink" href="#golem.Entry.findin_context" title="Permalink to this definition">¶</a></dt>
<dd>Find instances of this dictionary entry in a (set of)
ElementTrees or filenames. Returns a set of nodes pointing into the
searched ElementTrees.</dd></dl>

<dl class="method">
<dt id="golem.Entry.getAllImplementations">
<!--[golem.Entry.getAllImplementations]--><tt class="descname">getAllImplementations</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.Entry.getAllImplementations" title="Permalink to this definition">¶</a></dt>
<dd>Recursively identify and return all entries which &lt;golem:implement&gt; the
current class (and which are in currently-loaded dictionaries).</dd></dl>

<dl class="method">
<dt id="golem.Entry.getChildren">
<!--[golem.Entry.getChildren]--><tt class="descname">getChildren</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.Entry.getChildren" title="Permalink to this definition">¶</a></dt>
<dd>Recursively identify and return all entries which are &lt;golem:children&gt;
of the current concept - i.e. only ever appear as childNodes of the
(XML) node, or nodes, with which this dictionary entry is associated.</dd></dl>

<dl class="method">
<dt id="golem.Entry.list_to_arbdict">
<!--[golem.Entry.list_to_arbdict]--><tt class="descname">list_to_arbdict</tt><big>(</big><em>l</em><big>)</big><a class="headerlink" href="#golem.Entry.list_to_arbdict" title="Permalink to this definition">¶</a></dt>
<dd><p>Map a matrix onto a dictionary for subsequent output using XSLT.</p>
<p>The algorithm used is:</p>
<ol class="arabic simple">
<li>Check that the matrix is of the correct shape and within bounds.</li>
<li>From left to right row-wise from the upper left, number off 
the matrix elements  p1, p2, p3... pn (for an n-element matrix), and store 
these in a dictionary {&#8220;p1&#8221;: p1, &#8220;p2&#8221;: p2 ...}.</li>
<li>Return the resulting dictionary.</li>
</ol>
</dd></dl>

<dl class="method">
<dt id="golem.Entry.matrix_boundscheck">
<!--[golem.Entry.matrix_boundscheck]--><tt class="descname">matrix_boundscheck</tt><big>(</big><em>l</em><big>)</big><a class="headerlink" href="#golem.Entry.matrix_boundscheck" title="Permalink to this definition">¶</a></dt>
<dd>Check that the elements of a given matrix have the type, and lie within
the bounds, defined in the current dictionary entry.</dd></dl>

<dl class="method">
<dt id="golem.Entry.matrix_coercelist">
<!--[golem.Entry.matrix_coercelist]--><tt class="descname">matrix_coercelist</tt><big>(</big><em>l</em><big>)</big><a class="headerlink" href="#golem.Entry.matrix_coercelist" title="Permalink to this definition">¶</a></dt>
<dd>Coerce a matrix into a list, left-to-right, top-to-bottom.</dd></dl>

<dl class="method">
<dt id="golem.Entry.matrix_shapecheck">
<!--[golem.Entry.matrix_shapecheck]--><tt class="descname">matrix_shapecheck</tt><big>(</big><em>l</em><big>)</big><a class="headerlink" href="#golem.Entry.matrix_shapecheck" title="Permalink to this definition">¶</a></dt>
<dd>Check that a given matrix is, or can be coerced, into the shape
defined in this dictionary entry.</dd></dl>

<dl class="method">
<dt id="golem.Entry.parsexml">
<!--[golem.Entry.parsexml]--><tt class="descname">parsexml</tt><big>(</big><em>x</em>, <em>asModel=False</em><big>)</big><a class="headerlink" href="#golem.Entry.parsexml" title="Permalink to this definition">¶</a></dt>
<dd><p>Load a dictionary entry from its XML representation.</p>
<p>arguments: (etree for the entry, parent dictionary object).</p>
<p>Set asModel to true if you&#8217;re using this dictionary as a model
for building a new one: it stashes way more of the native XML in that
case, allowing you to serialize it out directly into your new dictionary.
At present, this is only used by the dictionary generator
(bin/make_dictionary.py in your Golem distribution.)</p>
</dd></dl>

<dl class="method">
<dt id="golem.Entry.serialize">
<!--[golem.Entry.serialize]--><tt class="descname">serialize</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.Entry.serialize" title="Permalink to this definition">¶</a></dt>
<dd>Write out this dictionary entry as XML.</dd></dl>

<dl class="method">
<dt id="golem.Entry.with_predicate">
<!--[golem.Entry.with_predicate]--><tt class="descname">with_predicate</tt><big>(</big><em>predicate</em><big>)</big><a class="headerlink" href="#golem.Entry.with_predicate" title="Permalink to this definition">¶</a></dt>
<dd><p>Set a predicate (condition) on a particular Entry instance.</p>
<p>This predicate will be honoured on subsequent calls to x.findin for
entry x; it takes the form of an XPath function.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="golem.ImpOnlyEntry">
<!--[golem.ImpOnlyEntry]-->class <tt class="descclassname">golem.</tt><tt class="descname">ImpOnlyEntry</tt><a class="headerlink" href="#golem.ImpOnlyEntry" title="Permalink to this definition">¶</a></dt>
<dd>Dictionary helper class: this is used to store information on entries
which have been pointed to (by, say, &lt;golem:implements&gt;), but which haven&#8217;t
themselves been parsed yet.</dd></dl>

<dl class="function">
<dt id="golem.loadDictionary">
<!--[golem.loadDictionary]--><tt class="descclassname">golem.</tt><tt class="descname">loadDictionary</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#golem.loadDictionary" title="Permalink to this definition">¶</a></dt>
<dd><p>Load a dictionary from a default location on the filesystem.</p>
<p>On Windows, this is C:cmldictionariesand must be changed by 
editing golem.py by hand: on Unix, it defaults to ~/.cmldictionaries/
but can be overridden by setting the environment variable
CMLDICTIONARIES.</p>
</dd></dl>

<dl class="function">
<dt id="golem.setDataWarning">
<!--[golem.setDataWarning]--><tt class="descclassname">golem.</tt><tt class="descname">setDataWarning</tt><big>(</big><em>val</em><big>)</big><a class="headerlink" href="#golem.setDataWarning" title="Permalink to this definition">¶</a></dt>
<dd><p>Set whether warnings will be emitted when unit/type-bearing data is modified.</p>
<p>Default is True.</p>
</dd></dl>

<dl class="function">
<dt id="golem.setTypeWarning">
<!--[golem.setTypeWarning]--><tt class="descclassname">golem.</tt><tt class="descname">setTypeWarning</tt><big>(</big><em>val</em><big>)</big><a class="headerlink" href="#golem.setTypeWarning" title="Permalink to this definition">¶</a></dt>
<dd><p>Set whether warnings will be emitted when a dictionary Entry without
a defined type is used.</p>
<p>Default is True.</p>
</dd></dl>

</div>
<div class="section" id="module-golem.helpers">
<h2 id="module-golem.helpers">golem.helpers<a class="headerlink" href="#module-golem.helpers" title="Permalink to this headline">¶</a></h2>
<div class="section" id="module-golem.helpers.generics">
<h3 id="module-golem.helpers.generics">golem.helpers.generics<a class="headerlink" href="#module-golem.helpers.generics" title="Permalink to this headline">¶</a></h3>
<dl class="function">
<dt id="golem.helpers.generics.hexstring">
<!--[golem.helpers.generics.hexstring]--><tt class="descclassname">golem.helpers.generics.</tt><tt class="descname">hexstring</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.helpers.generics.hexstring" title="Permalink to this definition">¶</a></dt>
<dd>Generate a random hex string based on nothing in particular.</dd></dl>

<dl class="function">
<dt id="golem.helpers.generics.print_rdf_rich">
<!--[golem.helpers.generics.print_rdf_rich]--><tt class="descclassname">golem.helpers.generics.</tt><tt class="descname">print_rdf_rich</tt><big>(</big><em>x</em>, <em>resource</em>, <em>property=None</em><big>)</big><a class="headerlink" href="#golem.helpers.generics.print_rdf_rich" title="Permalink to this definition">¶</a></dt>
<dd><p>For a given Golem value x, with units x.unit and concept x.uri,
from URI &#8216;resource&#8217;, produce an RDF/XML fragment of the form:</p>
<pre>&lt;rdf:Description rdf:about="resource"&gt;
  &lt;dictionary:uri rdf:about="resource#fragment"&gt;
    &lt;golem:value datatype="http://example.org/json/"&gt;JSON literal
    &lt;/golem:value&gt;
    &lt;golem:units&gt;unit&lt;/golem:units&gt;
  &lt;/dictionary:uri&gt;
&lt;/rdf:Description&gt;</pre>
</dd></dl>

</div>
<div class="section" id="module-golem.helpers.dataset">
<h3 id="module-golem.helpers.dataset">golem.helpers.dataset<a class="headerlink" href="#module-golem.helpers.dataset" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="golem.helpers.dataset.caching_dataset">
<!--[golem.helpers.dataset.caching_dataset]-->class <tt class="descclassname">golem.helpers.dataset.</tt><tt class="descname">caching_dataset</tt><big>(</big><em>cachefile</em>, <em>dbfile</em>, <em>dbformat</em>, <em>dictionaryfile</em>, <em>dictionarynamespace</em><big>)</big><a class="headerlink" href="#golem.helpers.dataset.caching_dataset" title="Permalink to this definition">¶</a></dt>
<dd><p>If you&#8217;re trying to build a program to interact with a large corpus
of CML, this is a good place to start.</p>
<p>Arguments:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">cachefile</span></tt>: file in which cached query results against this dataset are saved</li>
<li><tt class="docutils literal"><span class="pre">dbfile</span></tt>: path to where the DB we&#8217;re querying resides</li>
<li><tt class="docutils literal"><span class="pre">dbformat</span></tt>: which DB driver you&#8217;re using. You can plug in new databases here, but most of the time you&#8217;ll want <tt class="docutils literal"><span class="pre">golem.db.fs</span></tt>, the directory-full-of-files driver.</li>
<li><tt class="docutils literal"><span class="pre">dictionaryfile</span></tt>: which CML/Golem dictionary to use for queries.</li>
<li><tt class="docutils literal"><span class="pre">dictionarynamespace</span></tt>: Namespace of the above dictionary.</li>
</ul>
<dl class="method">
<dt id="golem.helpers.dataset.caching_dataset.go">
<!--[golem.helpers.dataset.caching_dataset.go]--><tt class="descname">go</tt><big>(</big><em>graphfile</em>, <em>output=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x13068&gt;</em>, <em>format='verbose'</em>, <em>cache=None</em><big>)</big><a class="headerlink" href="#golem.helpers.dataset.caching_dataset.go" title="Permalink to this definition">¶</a></dt>
<dd><p>Run any attached queries or fits against this dataset and return the results.</p>
<p><tt class="docutils literal"><span class="pre">graphfile</span></tt>, here, is the path for a Pelote plot, if you wish to make one;
<tt class="docutils literal"><span class="pre">output</span></tt> is a file-like object to write output to, and <tt class="docutils literal"><span class="pre">format</span></tt> is the
format in which to return results.</p>
</dd></dl>

<dl class="method">
<dt id="golem.helpers.dataset.caching_dataset.loadcache">
<!--[golem.helpers.dataset.caching_dataset.loadcache]--><tt class="descname">loadcache</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.helpers.dataset.caching_dataset.loadcache" title="Permalink to this definition">¶</a></dt>
<dd>Load query cache as a pickle.</dd></dl>

<dl class="method">
<dt id="golem.helpers.dataset.caching_dataset.savecache">
<!--[golem.helpers.dataset.caching_dataset.savecache]--><tt class="descname">savecache</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.helpers.dataset.caching_dataset.savecache" title="Permalink to this definition">¶</a></dt>
<dd>Save query cache.</dd></dl>

</dd></dl>

<dl class="class">
<dt id="golem.helpers.dataset.dataset">
<!--[golem.helpers.dataset.dataset]-->class <tt class="descclassname">golem.helpers.dataset.</tt><tt class="descname">dataset</tt><big>(</big><em>dbfile</em>, <em>dbformat</em>, <em>dictionaryfile</em>, <em>dictionarynamespace</em><big>)</big><a class="headerlink" href="#golem.helpers.dataset.dataset" title="Permalink to this definition">¶</a></dt>
<dd><p>Generic representation of a collection of CML data with an
attached Golem query (see <tt class="docutils literal"><span class="pre">register</span></tt>) and, optionally, one
or more functions to be fitted to the result of that query 
(see <tt class="docutils literal"><span class="pre">addfunction</span></tt>).</p>
<p>For most practical purposes, you&#8217;re going to want to use
<tt class="docutils literal"><span class="pre">caching_dataset</span></tt>, which inherits from this, instead, with the
<tt class="docutils literal"><span class="pre">golem.db.fs</span></tt> driver (<tt class="docutils literal"><span class="pre">dbformat</span></tt> in the class signature.)</p>
<dl class="method">
<dt id="golem.helpers.dataset.dataset.addfunction">
<!--[golem.helpers.dataset.dataset.addfunction]--><tt class="descname">addfunction</tt><big>(</big><em>name</em>, <em>function</em>, <em>params</em><big>)</big><a class="headerlink" href="#golem.helpers.dataset.dataset.addfunction" title="Permalink to this definition">¶</a></dt>
<dd>Add a function you wish to fit to the data resulting from a query attached
to this dataset.</dd></dl>

<dl class="method">
<dt id="golem.helpers.dataset.dataset.dispatch">
<!--[golem.helpers.dataset.dataset.dispatch]--><tt class="descname">dispatch</tt><big>(</big><em>format</em>, <em>cache=None</em><big>)</big><a class="headerlink" href="#golem.helpers.dataset.dataset.dispatch" title="Permalink to this definition">¶</a></dt>
<dd>Run any fits or queries attached to this dataset, but do not
return the results.</dd></dl>

<dl class="method">
<dt id="golem.helpers.dataset.dataset.go">
<!--[golem.helpers.dataset.dataset.go]--><tt class="descname">go</tt><big>(</big><em>graphfile</em>, <em>output=&lt;open file '&lt;stdout&gt;'</em>, <em>mode 'w' at 0x13068&gt;</em>, <em>format='verbose'</em>, <em>cache=None</em><big>)</big><a class="headerlink" href="#golem.helpers.dataset.dataset.go" title="Permalink to this definition">¶</a></dt>
<dd>Run all queries and function fitting processes attached to this dataset,
returning the results.</dd></dl>

<dl class="method">
<dt id="golem.helpers.dataset.dataset.makeplot">
<!--[golem.helpers.dataset.dataset.makeplot]--><tt class="descname">makeplot</tt><big>(</big><em>format</em>, <em>graphfile</em><big>)</big><a class="headerlink" href="#golem.helpers.dataset.dataset.makeplot" title="Permalink to this definition">¶</a></dt>
<dd>Plot any queries and fitted functions attached to this dataset.</dd></dl>

<dl class="method">
<dt id="golem.helpers.dataset.dataset.register">
<!--[golem.helpers.dataset.dataset.register]--><tt class="descname">register</tt><big>(</big><em>xconcepts</em>, <em>yconcepts</em>, <em>xpredicate=None</em>, <em>ypredicate=None</em>, <em>xreducer=None</em>, <em>yreducer=None</em><big>)</big><a class="headerlink" href="#golem.helpers.dataset.dataset.register" title="Permalink to this definition">¶</a></dt>
<dd><p>Attach a query (consisting of a pair of lists of Golem concepts,
each producing one datapoint per file) to this dataset.</p>
<p>A dataset may only have one query (and therefore set of fits)
attached at once; attaching a new query through <tt class="docutils literal"><span class="pre">register</span></tt> loses
any previously attached fits or retrieved queries.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-golem.helpers.dict">
<h3 id="module-golem.helpers.dict">golem.helpers.dict<a class="headerlink" href="#module-golem.helpers.dict" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="golem.helpers.dict.cmlconcept">
<!--[golem.helpers.dict.cmlconcept]-->class <tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">cmlconcept</tt><big>(</big><em>keys</em>, <em>parentConcept</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.cmlconcept" title="Permalink to this definition">¶</a></dt>
<dd><p>Concept extracted from a corpus of CML data.</p>
<p>When analysing a corpus of CML data in order to produce a dictionary, every dictRef
encountered is mapped to an instance of this class; therefore, this class contains
helper methods to output</p>
<dl class="method">
<dt id="golem.helpers.dict.cmlconcept.hasPayload">
<!--[golem.helpers.dict.cmlconcept.hasPayload]--><tt class="descname">hasPayload</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.helpers.dict.cmlconcept.hasPayload" title="Permalink to this definition">¶</a></dt>
<dd>Does this concept have a payload (is self.payload not None)?</dd></dl>

<dl class="method">
<dt id="golem.helpers.dict.cmlconcept.isRelative">
<!--[golem.helpers.dict.cmlconcept.isRelative]--><tt class="descname">isRelative</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.helpers.dict.cmlconcept.isRelative" title="Permalink to this definition">¶</a></dt>
<dd>Is this concept relatively-positioned?</dd></dl>

<dl class="method">
<dt id="golem.helpers.dict.cmlconcept.setPayload">
<!--[golem.helpers.dict.cmlconcept.setPayload]--><tt class="descname">setPayload</tt><big>(</big><em>payloadtype</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.cmlconcept.setPayload" title="Permalink to this definition">¶</a></dt>
<dd>Set the payload of this concept - the type of data, if any, it contains.</dd></dl>

<dl class="method">
<dt id="golem.helpers.dict.cmlconcept.setRelative">
<!--[golem.helpers.dict.cmlconcept.setRelative]--><tt class="descname">setRelative</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.helpers.dict.cmlconcept.setRelative" title="Permalink to this definition">¶</a></dt>
<dd><p>State that this concept is relatively, not absolutely, positioned.</p>
<p>A relatively-positioned concept occurs in more than one location within
the documents in this corpus (as distinguished by XPath expressions); 
an absolutely-positioned concept always occurs in the same place.</p>
</dd></dl>

<dl class="method">
<dt id="golem.helpers.dict.cmlconcept.xpathfragment">
<!--[golem.helpers.dict.cmlconcept.xpathfragment]--><tt class="descname">xpathfragment</tt><big>(</big><em>id=True</em>, <em>title=True</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.cmlconcept.xpathfragment" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate an XPath expression which identifies an XML node corresponding to
the current concept.</p>
<p>This XPath expression ignores the document context in which the concept was
found - ie, &#8220;//%%s&#8221; %% (xpath) would find all instances of this concept within
a given XML document.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="golem.helpers.dict.concept">
<!--[golem.helpers.dict.concept]-->class <tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">concept</tt><big>(</big><em>keys</em>, <em>parentConcept</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.concept" title="Permalink to this definition">¶</a></dt>
<dd>Abstract representation of a &#8216;concept&#8217; within a corpus of XML data; ie, a
common structure used to denote a semantically-meaningful unit within a collection
of semi-structured documents.</dd></dl>

<dl class="class">
<dt id="golem.helpers.dict.conceptset">
<!--[golem.helpers.dict.conceptset]-->class <tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">conceptset</tt><big>(</big><em>keys</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.conceptset" title="Permalink to this definition">¶</a></dt>
<dd><p>A collection of the concepts found in a corpus of documents we&#8217;re analysing.</p>
<dl class="method">
<dt id="golem.helpers.dict.conceptset.addconcept">
<!--[golem.helpers.dict.conceptset.addconcept]--><tt class="descname">addconcept</tt><big>(</big><em>concept</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.conceptset.addconcept" title="Permalink to this definition">¶</a></dt>
<dd>Add a concept to this conceptset.</dd></dl>

</dd></dl>

<dl class="function">
<dt id="golem.helpers.dict.make">
<!--[golem.helpers.dict.make]--><tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">make</tt><big>(</big><em>filenames</em>, <em>namespace</em>, <em>prefix</em>, <em>title</em>, <em>groupings</em>, <em>model=None</em>, <em>inputfn=None</em>, <em>use_id=True</em>, <em>use_title=True</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.make" title="Permalink to this definition">¶</a></dt>
<dd><p>Build a dictionary.</p>
<p>Arguments:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">filenames</span></tt> - list of CML files comprising the corpus to be analysed.</li>
<li><tt class="docutils literal"><span class="pre">namespace</span></tt> - namespace of the dictionary</li>
<li><tt class="docutils literal"><span class="pre">prefix</span></tt> - short prefix to be used within the dictionary and namespace declaration</li>
<li><tt class="docutils literal"><span class="pre">title</span></tt> - Title of the dictionary (eg &#8216;CASTEP dictionary&#8217;)</li>
<li><tt class="docutils literal"><span class="pre">groupings</span></tt> - Extra groupings to be determined for entries. If the XPath for this entry contains the key, then this entry is a &lt;golem:instanceOf&gt; the grouping.</li>
<li><tt class="docutils literal"><span class="pre">model</span></tt> - Optionally, a dictionary to copy definitions/descriptions/terms from.</li>
<li><tt class="docutils literal"><span class="pre">inputfn</span></tt> - Optionally, an input file containing extra dictionary entries, not found in the corpus supplied, which should be added to the dictionary.</li>
<li><tt class="docutils literal"><span class="pre">use_id</span></tt>/<tt class="docutils literal"><span class="pre">use_title</span></tt> - distinguish concepts by unique ID/title as well as dictRef.</li>
</ul>
</dd></dl>

<dl class="function">
<dt id="golem.helpers.dict.parsecmlelement">
<!--[golem.helpers.dict.parsecmlelement]--><tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">parsecmlelement</tt><big>(</big><em>element</em>, <em>parent</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.parsecmlelement" title="Permalink to this definition">¶</a></dt>
<dd>Parse a chunk of CML representing a concept to an instance of <tt class="docutils literal"><span class="pre">cmlconcept</span></tt>.</dd></dl>

<dl class="function">
<dt id="golem.helpers.dict.parsecmltree">
<!--[golem.helpers.dict.parsecmltree]--><tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">parsecmltree</tt><big>(</big><em>element</em>, <em>conceptset</em>, <em>parent=None</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.parsecmltree" title="Permalink to this definition">¶</a></dt>
<dd>Parse an entire CML tree, recursively, parsing any concepts found and adding
them to the supplied <tt class="docutils literal"><span class="pre">conceptset</span></tt>.</dd></dl>

<dl class="function">
<dt id="golem.helpers.dict.print_dictfooter">
<!--[golem.helpers.dict.print_dictfooter]--><tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">print_dictfooter</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.helpers.dict.print_dictfooter" title="Permalink to this definition">¶</a></dt>
<dd>Return the common footer - including data-parsing XSLT stylesheets - for a
CML/Golem dictionary.</dd></dl>

<dl class="function">
<dt id="golem.helpers.dict.print_dictheader">
<!--[golem.helpers.dict.print_dictheader]--><tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">print_dictheader</tt><big>(</big><em>ns</em>, <em>prefix</em>, <em>title</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.print_dictheader" title="Permalink to this definition">¶</a></dt>
<dd>Return the common header for a CML/Golem dictionary with given namespace,
short name, and title.</dd></dl>

<dl class="function">
<dt id="golem.helpers.dict.print_dictionary">
<!--[golem.helpers.dict.print_dictionary]--><tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">print_dictionary</tt><big>(</big><em>ns</em>, <em>prefix</em>, <em>title</em>, <em>concepts</em>, <em>groupings</em>, <em>model=None</em>, <em>inputdict=None</em>, <em>use_id=True</em>, <em>use_title=True</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.print_dictionary" title="Permalink to this definition">¶</a></dt>
<dd><p>Write out a CML/Golem dictionary, using <tt class="docutils literal"><span class="pre">model</span></tt> as a source of
definitions, descriptions and terms, containing definitions for the
entries in <tt class="docutils literal"><span class="pre">concepts</span></tt> and the relationships between concepts defined
in <tt class="docutils literal"><span class="pre">groupings</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">prefix</span></tt> is the short name to be used in the namespace declaration; the 
namespace is <tt class="docutils literal"><span class="pre">ns</span></tt>, and the dictionary will be entitled <tt class="docutils literal"><span class="pre">title</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="golem.helpers.dict.print_entry">
<!--[golem.helpers.dict.print_entry]--><tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">print_entry</tt><big>(</big><em>ns</em>, <em>prefix</em>, <em>c</em>, <em>concepts</em>, <em>groupings</em>, <em>model=None</em>, <em>inputdict=None</em>, <em>use_id=True</em>, <em>use_title=True</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.print_entry" title="Permalink to this definition">¶</a></dt>
<dd>Dump a given concept in CML/Golem dictionary format.</dd></dl>

<dl class="function">
<dt id="golem.helpers.dict.print_tree">
<!--[golem.helpers.dict.print_tree]--><tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">print_tree</tt><big>(</big><em>concepttree</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.print_tree" title="Permalink to this definition">¶</a></dt>
<dd>Dump a tree of concepts found in a corpus of documents as a GraphViz .dot file.</dd></dl>

<dl class="function">
<dt id="golem.helpers.dict.xpath_concept">
<!--[golem.helpers.dict.xpath_concept]--><tt class="descclassname">golem.helpers.dict.</tt><tt class="descname">xpath_concept</tt><big>(</big><em>c</em>, <em>concepts</em>, <em>id=True</em>, <em>title=True</em><big>)</big><a class="headerlink" href="#golem.helpers.dict.xpath_concept" title="Permalink to this definition">¶</a></dt>
<dd>Calculate the XPath for a given concept in a given corpus of documents,
by backtracking over its parents to determine the longest common
- ie, most specific - path which captures all instances of it within the corpus.</dd></dl>

</div>
<div class="section" id="module-golem.helpers.function">
<h3 id="module-golem.helpers.function">golem.helpers.function<a class="headerlink" href="#module-golem.helpers.function" title="Permalink to this headline">¶</a></h3>
</div>
<div class="section" id="module-golem.helpers.output">
<h3 id="module-golem.helpers.output">golem.helpers.output<a class="headerlink" href="#module-golem.helpers.output" title="Permalink to this headline">¶</a></h3>
<dl class="function">
<dt id="golem.helpers.output.csv">
<!--[golem.helpers.output.csv]--><tt class="descclassname">golem.helpers.output.</tt><tt class="descname">csv</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#golem.helpers.output.csv" title="Permalink to this definition">¶</a></dt>
<dd>Outputs x,y data in .csv format.</dd></dl>

<dl class="class">
<dt id="golem.helpers.output.pelote">
<!--[golem.helpers.output.pelote]-->class <tt class="descclassname">golem.helpers.output.</tt><tt class="descname">pelote</tt><big>(</big><em>title=None</em><big>)</big><a class="headerlink" href="#golem.helpers.output.pelote" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a Pelote graph.</p>
<dl class="method">
<dt id="golem.helpers.output.pelote.addaxis">
<!--[golem.helpers.output.pelote.addaxis]--><tt class="descname">addaxis</tt><big>(</big><em>orientation</em>, <em>position=None</em>, <em>title=None</em>, <em>numticks=None</em>, <em>ticks=None</em><big>)</big><a class="headerlink" href="#golem.helpers.output.pelote.addaxis" title="Permalink to this definition">¶</a></dt>
<dd>Attach an axis to a Pelote plot.</dd></dl>

<dl class="method">
<dt id="golem.helpers.output.pelote.addpointlist">
<!--[golem.helpers.output.pelote.addpointlist]--><tt class="descname">addpointlist</tt><big>(</big><em>data=None</em><big>)</big><a class="headerlink" href="#golem.helpers.output.pelote.addpointlist" title="Permalink to this definition">¶</a></dt>
<dd>Attach a pointlist to a Pelote plot.</dd></dl>

<dl class="method">
<dt id="golem.helpers.output.pelote.addrange">
<!--[golem.helpers.output.pelote.addrange]--><tt class="descname">addrange</tt><big>(</big><em>floorX=None</em>, <em>floorY=None</em>, <em>ceilingX=None</em>, <em>ceilingY=None</em><big>)</big><a class="headerlink" href="#golem.helpers.output.pelote.addrange" title="Permalink to this definition">¶</a></dt>
<dd>Attach a range to a Pelote plot.</dd></dl>

<dl class="method">
<dt id="golem.helpers.output.pelote.serialize">
<!--[golem.helpers.output.pelote.serialize]--><tt class="descname">serialize</tt><big>(</big><big>)</big><a class="headerlink" href="#golem.helpers.output.pelote.serialize" title="Permalink to this definition">¶</a></dt>
<dd>Serialize a Pelote plot file as an ElementTree.</dd></dl>

<dl class="method">
<dt id="golem.helpers.output.pelote.write">
<!--[golem.helpers.output.pelote.write]--><tt class="descname">write</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#golem.helpers.output.pelote.write" title="Permalink to this definition">¶</a></dt>
<dd><p>Serialize and write out a Pelote plot to a file or file-like object.</p>
<p><tt class="docutils literal"><span class="pre">f</span></tt> can be either a string or a file-like object. If <tt class="docutils literal"><span class="pre">f</span></tt> is a string, 
it is taken to be the filename to use.</p>
</dd></dl>

</dd></dl>

</div>
</div>
<div class="section" id="module-golem.db">
<h2 id="module-golem.db">golem.db<a class="headerlink" href="#module-golem.db" title="Permalink to this headline">¶</a></h2>
<div class="section" id="module-golem.db.resultlist">
<h3 id="module-golem.db.resultlist">golem.db.resultlist<a class="headerlink" href="#module-golem.db.resultlist" title="Permalink to this headline">¶</a></h3>
<p>Golem resultlist class.</p>
<p>Ties a series of results to the file they came from.</p>
<div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span> <span class="o">=</span> <span class="n">resultlist</span><span class="p">(</span><span class="nb">range</span><span class="p">(</span><span class="mf">10</span><span class="p">),</span> <span class="n">filename</span><span class="o">=</span><span class="s">&quot;test.xml&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">x</span>
<span class="go">[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">x</span><span class="o">.</span><span class="n">filename</span>
<span class="go">test.xml</span>
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3>Table Of Contents</h3>
            <ul>
<li><a class="reference external" href="">Golem API documentation</a><ul>
<li><a class="reference external" href="#module-golem">golem</a></li>
<li><a class="reference external" href="#module-golem.helpers">golem.helpers</a><ul>
<li><a class="reference external" href="#module-golem.helpers.generics">golem.helpers.generics</a></li>
<li><a class="reference external" href="#module-golem.helpers.dataset">golem.helpers.dataset</a></li>
<li><a class="reference external" href="#module-golem.helpers.dict">golem.helpers.dict</a></li>
<li><a class="reference external" href="#module-golem.helpers.function">golem.helpers.function</a></li>
<li><a class="reference external" href="#module-golem.helpers.output">golem.helpers.output</a></li>
</ul>
</li>
<li><a class="reference external" href="#module-golem.db">golem.db</a><ul>
<li><a class="reference external" href="#module-golem.db.resultlist">golem.db.resultlist</a></li>
</ul>
</li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="examples.html" title="previous chapter">Golem examples</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="colophon.html" title="next chapter">Colophon</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/apidoc.txt">Show Source</a></li>
            </ul>
            <h3>Quick search</h3>
            <form class="search" action="search.html" method="get">
              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
              <input type="hidden" name="check_keywords" value="yes" />
              <input type="hidden" name="area" value="default" />
            </form>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="colophon.html" title="Colophon"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="examples.html" title="Golem examples"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Golem v1.0 documentation</a> &raquo;</li>
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2008, Andrew Walkingshaw.
      Last updated on Oct 01, 2008.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
    </div>
  </body>
</html>